<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body, html {
	width: 100%;
	height: 100%;
	margin: 0;
	font-family: "微软雅黑";
}

#allmap {
	width: 70%;
	height: 500px;
}

p {
	margin-left: 5px;
	font-size: 14px;
}
</style>
<script type="text/javascript"
	src="http://api.map.baidu.com/api?v=2.0&ak=4IU3oIAMpZhfWZsMu7xzqBBAf6vMHcoa"></script>
<title>齐鲁软件园</title>
</head>
<body>
	<div id="allmap"></div>
	<div><input type="button" value="清除点" onclick="deletePoint()"/> </div>
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
	var sContent = "<h4 style='margin:0 0 5px 0;padding:0.2em 0'>齐鲁软件园</h4>"
			+ "<img style='float:right;margin:4px' id='imgDemo' src='pict.bmp' width='139' height='104' title='齐鲁软件园'/>"
			+ "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>此处是齐鲁软件园，这里可能是我们将来工作的地方...</p>"
			+ "</div>";
	var map = new BMap.Map("allmap");
	map.enableScrollWheelZoom(); 
	var point = new BMap.Point(117.138472, 36.678554);
	var marker = new BMap.Marker(point);
	var infoWindow = new BMap.InfoWindow(sContent); // 创建信息窗口对象
	map.centerAndZoom(point, 15);
	map.addOverlay(marker);
	marker.addEventListener("click", function() {
		this.openInfoWindow(infoWindow);
		//图片加载完毕重绘infowindow
		document.getElementById('imgDemo').onload = function() {
			infoWindow.redraw(); //防止在网速较慢，图片未加载时，生成的信息框高度比图片的总高度小，导致图片部分被隐藏
		}
	});
	
	function deletePoint(){
		map.removeOverlay(marker);
	}
</script>